package net.exoweb.animate.animaters
{
    import flash.display.DisplayObject;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.EventDispatcher;

    import net.exoweb.animate.actions.Action;
    import net.exoweb.animate.common.Time;

    public class Animater extends Sprite
    {
        private var _eventDispatcher:EventDispatcher;
        private var _actions:Array;
        private var _objects:Array;

        public function Animater()
        {
            _eventDispatcher = new EventDispatcher();
            _actions = new Array();
            _objects = new Array();
        }

        public function addAction(v:Action):void
        {
            _actions.push(v);
        }

        public function addObject(v:DisplayObject):void
        {
            _objects.push(v);
            addChild(v);
        }

        public function update(time:Number):void
        {
            for(var i:int=0; i<_actions.length; i++)
            {
                for(var j:int=0; j<_objects.length; j++)
                {
                    _actions[i].update(_objects[j], time);
                }
            }
        }
    }
}
